<?php
	namespace AppBundle\Entity;
	
	use Doctrine\ORM\Mapping as ORM;
    use Doctrine\Common\Collections\ArrayCollection;
	/**
	 * @ORM\Entity
	 * @ORM\Table(name="student")
	 */
	class Student{
		/**
		 * @ORM\Column(type="integer")
		 * @ORM\Id
		 * @ORM\GeneratedValue(strategy="AUTO")
		 * @var [type]
		 */
		private $id;

		/**
		 * @ORM\Column(type="string",length=32)
		 * @var [type]
		 */
		private $name;

		/**
		 * @ORM\Column(type="integer")
		 * @var [type]
		 */
		private $age;

		/**
		 * @ORM\OneToMany(targetEntity="Major",mappedBy="student",cascade={"persist"})
		 * @ORM\JoinColumn(name="major",referencedColumnName="id")
		 * @var [type]
		 */
		private $majors;

		/**
		 * @ORM\ManyToOne(targetEntity="Grade",inversedBy="student")
		 * @ORM\JoinColumn(name="grade",referencedColumnName="id")
		 * @var [type]
		 */
		private $grade;

        /**
         * @ORM\Column(type="datetime")
         * @var [type]
         */
        private $addtime;

    public function __construct(){
        $this->majors = new ArrayCollection();
    }
	
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return Student
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set age
     *
     * @param integer $age
     *
     * @return Student
     */
    public function setAge($age)
    {
        $this->age = $age;

        return $this;
    }

    /**
     * Get age
     *
     * @return integer
     */
    public function getAge()
    {
        return $this->age;
    }

    /**
     * Set grade
     *
     * @param \AppBundle\Entity\Grade $grade
     *
     * @return Student
     */
    public function setGrade(\AppBundle\Entity\Grade $grade = null)
    {
        $this->grade = $grade;

        return $this;
    }

    /**
     * Get grade
     *
     * @return \AppBundle\Entity\Grade
     */
    public function getGrade()
    {
        return $this->grade;
    }

    /**
     * Set addtime
     *
     * @param \DateTime $addtime
     *
     * @return Student
     */
    public function setAddtime($addtime)
    {
        $this->addtime = $addtime;

        return $this;
    }

    /**
     * Get addtime
     *
     * @return \DateTime
     */
    public function getAddtime()
    {
        return $this->addtime;
    }

    /**
     * Add major
     *
     * @param \AppBundle\Entity\Major $major
     *
     * @return Student
     */
    public function addMajor(\AppBundle\Entity\Major $major)
    {
        $this->majors[] = $major;

        return $this;
    }

    /**
     * Remove major
     *
     * @param \AppBundle\Entity\Major $major
     */
    public function removeMajor(\AppBundle\Entity\Major $major)
    {
        $this->majors->removeElement($major);
    }

    /**
     * Get majors
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMajors()
    {
        return $this->majors;
    }
}
